<include file="Public/min-header"/>
<div class="wrapper">
    <!-- Content Header (Page header) -->
   <include file="Public/breadcrumb"/>
    <section class="content">
    <!-- Main content -->
    <!--<div class="container-fluid">-->
    <div class="row">
      <div class="col-sm-12">
        <div class="panel panel-default">
            <div class="panel-heading">
                <h3 class="panel-title"><i class="fa fa-list"></i> 用户信息</h3>
            </div>
            <div class="panel-body">
                <form action="" method="post" onsubmit="return checkUserUpdate(this);">
                    <table class="table table-bordered">
                    <tbody>
                    <tr>
                        <td class="col-sm-2">会员昵称:</td>
                        <td ><img src="{$user.head_pic}" width="110">&nbsp;&nbsp;<input type="text" class="form-control" name="nick_name" value="{$user.nick_name}"></td>
                        <td></td>
                    </tr>
                   <tr>
                        <td>会员姓名:</td>
                        <td><input type="text" class="form-control" name="nickname" value="{$user.nickname}"></td>
                        <td>用户真实姓名</td>
                    <tr>

                    <tr>
                        <td>会员密码:</td>
                        <td><input type="text" class="form-control" name="password" value=""></td>
                        <!--                        <td>默认密码666666</td>-->
                    <tr>
                    <tr>
                        <td>用户积分:</td>
                        <td>{$user.pay_points} <span style="margin-left:100px;">账户余额：{$user.user_money}</span></td>
                        <td></td>
                    </tr>

                        <td>公司/店铺名称:</td>
                        <td><input type="text" class="form-control" name="company" value="{$user['company']}"></td>
                        <td>公司名称</td>
                    </tr>
                    <tr>
                        <td>公司/店铺地址:</td>
                        <td><input type="text" class="form-control" name="company_address" value="{$user['company_address']}"></td>
                        <td>公司或者商铺地址</td>
                    </tr>
                    <tr>
                        <td>会员等级:</td>
                        <td>
                            <select class="form-control" name="level">
                                <option value="0">请选择</option>
                                <foreach name="level" item="vo" key="k" >
                                    <option <if condition="$vo[level_id] eq $user[level]"  >selected</if>  value="{$vo.level_id}">{$vo.level_name}</option>
                                </foreach>
                            </select>
                        </td>
                    </tr>
                    <!--<tr>-->
                        <!--<td>会员等级:</td>-->
                        <!--<td>{$user.user_rank}</td>-->
                    <!--</tr>-->
                    <tr>
                        <td>性别:</td>
                        <td id="order-status">
                            <input name="sex" type="radio" value="0" <if condition="$user['sex'] eq 0">checked</if> >保密
                            <input name="sex" type="radio" value="1" <if condition="$user['sex'] eq 1">checked</if> >男
                            <input name="sex" type="radio" value="2" <if condition="$user['sex'] eq 2">checked</if> >女
                        </td>
                        <td></td>
                    </tr>
                    <tr>
                        <td>QQ:</td>
                        <td>
                            <input class="form-control" type="text" name="qq" value="{$user.qq}">
                        </td>
                        <td></td>
                    </tr>
                    <tr>
                        <td>手机:</td>
                        <td>
                            <input type="text" class="form-control" name="mobile" value="{$user.mobile}">
                        </td>
                        <td></td>
                    </tr>
                    <tr>
                        <td>冻结用户:</td>
                        <td>
                            <input name="is_lock" type="radio" value="1" <if condition="$user['is_lock'] eq 1">checked</if> >是
                            <input name="is_lock" type="radio" value="0" <if condition="$user['is_lock'] eq 0">checked</if> >否
                        </td>
                        <td></td>
                    </tr>
                     <tr>
                        <td>店内环境照:</td>
                        <td>
                           <input type="text" class="form-control"  name="environmentalphotos" id="environmentalphotos" style="width:250px;" value="{$user.environmentalphotos}" placeholder="可输入图片地址"/>
										<input type="button" class="btn btn-primary" value="上传图片"  onclick="GetUploadify(1,'','goods','call_back');"/>
                                        <if condition="$user['environmentalphotos'] neq null">
                                            &nbsp;&nbsp;
                                            <a target="_blank" href="{$user.environmentalphotos}" id="environmentalphotos2">
                                                <img width="45" height="45" src="{$user.environmentalphotos}">
                                            </a>
                                        </if> <span style="color:red;"></span>
                                        <span id="err_original_img" style="color:#F00; display:none;"></span>
                        <td></td>
                    </tr>
                    <tr>
                        <td>门头照:</td>
                        <td>
                           <input type="text" class="form-control"  name="doorphoto" id="doorphoto" style="width:250px;" value="{$user.doorphoto}" placeholder="可输入图片地址"/>
										<input type="button" class="btn btn-primary" value="上传图片"  onclick="GetUploadify(1,'','goods','call_back2');"/>
                                        <if condition="$user['doorphoto'] neq null">
                                            &nbsp;&nbsp;
                                            <a target="_blank" href="{$user.doorphoto}" id="doorphoto2">
                                                <img width="45" height="45" src="{$user.doorphoto}">
                                            </a>
                                        </if> <span style="color:red;"></span>
                                        <span id="err_original_img" style="color:#F00; display:none;"></span>
                        <td></td>
                    </tr>
                    <tr>
                        <td>注册时间:</td>
                        <td>
                            {$user.reg_time|date='Y-m-d H:i',###}
                        </td>
                        <td></td>
                    </tr>
					<?php
					if(session('fenbu_id')==0){
					?>
                   <tr style="color:#ff9800;">
                       <td>所属分部:</td>
                       <td>
                   	<select name="fenbu_id" id="fenbu_id" class="form-control" style="width:200px;">
                               <foreach name="fenbu_list" item="v">
                                  <option value="{$v['fenbu_id']}" <if condition="$v['fenbu_id'] eq $user['fenbu_id'] ">selected="selected"</if>>
                                  	{$v['fenbu_name']}
                                  </option>
                           	</foreach>
                         </select>
                       </td>
                   </tr>
				   <?php
				   }else{
				   	echo '<input type="hidden" name="fenbu_id" id="fenbu_id" value="'.session('fenbu_id').'" />';
				   }
				   ?>
                    <tr>
                        <td>是否分销:</td>
                        <td id="order-status">                            
                            <input name="is_distribut" type="radio" value="1" <if condition="$user['is_distribut'] eq 1">checked</if> >是
                            <input name="is_distribut" type="radio" value="0" <if condition="$user['is_distribut'] eq 0">checked</if> >否
                        </td>
                        <td></td>
                    </tr>                    
                    <tr>
                        <table  class="table table-bordered">
                            
                            <tr>
                                    <td>用户余额:</td>
                                    <td>{$user.user_money}</td>
                                    <td>累积分佣金额:</td>
                                    <td>{$user.distribut_money}</td>    
                                </tr>                            
                            
                             <tr>
                                <td>上一级编号</td>
                                    <td>                            
                                        <if condition='$user[first_leader] gt 0'>
                                                <a href="{:U(detail,array('id'=>$user[first_leader]))}">{$user.first_leader}</a>
                                        <else />
                                                {$user.first_leader}
                                        </if>                           
                                    </td>                                
                                    <td>一级下线数</td>
                                    <td>{$user.first_lower}</td>    
                                </tr>
                                
                                <tr>
                                    <td>上二级编号</td>
                                    <td>                            
                                        <if condition='$user[second_leader] gt 0'>
                                                <a href="{:U(detail,array('id'=>$user[second_leader]))}">{$user.second_leader}</a>
                                        <else />
                                                {$user.second_leader}
                                        </if>                           
                                    </td>
                                    <td>二级下线数</td>
                                    <td>{$user.second_lower}</td>                                
                                </tr>
                                <tr>
                                    <td>上三级编号</td>
                                    <td>                            
                                        <if condition='$user[third_leader] gt 0'>
                                                <a href="{:U(detail,array('id'=>$user[third_leader]))}">{$user.third_leader}</a>
                                        <else />
                                                {$user.third_leader}
                                        </if>                           
                                    </td>                                 
                                    <td>三级下线数</td>
                                    <td>{$user.third_lower}</td>                                   
                           </tr>                    
                        </table>
                    </tr>             
                    <tr>
                        <td></td>
                        <td>
                            <button type="submit" class="btn btn-info">
                                <i class="ace-icon fa fa-check bigger-110"></i> 保存
                            </button>
                            <a href="javascript:history.go(-1)" data-toggle="tooltip" title="" class="btn btn-default pull-right" data-original-title="返回"><i class="fa fa-reply"></i></a>
                        </td>
                    </tr>
                    </tbody>
                </table>
                </form>

            </div>
        </div>
 	  </div> 
    </div>    <!-- /.content -->
   </section>
</div>
<script>
    function checkUserUpdate(){
        var email = $('input[name="email"]').val();
        var mobile = $('input[name="mobile"]').val();
		
		var nickname = $('input[name="nickname"]').val();
        var company = $('input[name="company"]').val();
        var company_address = $('input[name="company_address"]').val();

        var error ='';
        // if(password != password2){
        //     error += "两次密码不一样\n";
        // }

        //if(!checkEmail(email)){
            //error += "邮箱地址有误\n";
       // }
        //if(!checkMobile(mobile)){
           // error += "手机号码填写有误\n";
       // }
        if(error){
            layer.alert(error, {icon: 2});  //alert(error);
            return false;
        }
        return true;

    }
    function call_back(fileurl_tmp){
        $("#environmentalphotos").val('https://xjt.zczmer.com'+fileurl_tmp);
    	$("#environmentalphotos2").attr('href', 'https://xjt.zczmer.com'+fileurl_tmp);
    }
    function call_back2(fileurl_tmp){
        $("#doorphoto").val('https://xjt.zczmer.com'+fileurl_tmp);
    	$("#doorphoto2").attr('href', 'https://xjt.zczmer.com'+fileurl_tmp);
    }
</script>

</body>
</html>